package org.vectrics.recruiter.struts.admin.job;

import java.util.Collection;
import java.util.Iterator;

import org.vectrics.common.html.Combo;
import org.vectrics.recruiter.RecruitServiceLocator;
import org.vectrics.recruiter.job.JobPayType;

public class JobPayTypeCombo {
	private Combo combo = new Combo();

	public JobPayTypeCombo(JobPayType selected) {
		Collection payTypes = RecruitServiceLocator.getJobProvider().findAllJobPayTypes();
		Iterator iter = payTypes.iterator();
		while (iter.hasNext()) {
			JobPayType payType = (JobPayType)iter.next();
			combo.addOption(payType.getName(), payType.getCode());
		}
		if (selected != null) {
			combo.selectOption(selected.getCode());
		}
	}
	
	public Combo getCombo() {
		return(this.combo);
	}
	
	public String toString() {
		return(combo.toString());
	}
}
